#pragma once

#include "Scope.h"
#include "Symbol.h"

struct Symbolyzer
{
	enum Mode;

    Scope*	m_pxCurrentScope;
	Scope*  m_pxLookaheadScope;

	bool	m_bInsideFunction;
	bool	m_bFuncDefActive;

	Mode	m_eMode;
	Mode	m_eModeHistory;

	int		m_nLinenumber;

private:
    void onEntryParen(Scope& inNewScope, Scope& inOldScope);
    void onEntryBlock(Scope& inNewScope, Scope& inOldScope);

	bool isDataType(std::string& s);

	void matchDataType(Token& inToken);
	void matchVariable(Token& inToken);
	void matchTypedef(Token& inToken);
	
public:
    void onNewToken(Scope& inScope, Token& inToken);
    void onScopeEntry(Scope& inNewScope, Scope& inOldScope);
    void onScopeExit(Scope& inNewScope, Scope& inOldScope);

	void setScope(Scope& inScope)
	{
		m_pxCurrentScope = &inScope;
	} 

    Symbolyzer(void);
    ~Symbolyzer(void);

	enum Mode
	{
		eSymbolyzerInitial,
		eSymbolyzerTypedef,
		eSymbolyzerDataType,
		eSymbolyzerVariable
	};
};